    /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import vo.VOUserStats;

/**
 *
 * @author santiagobaldrich
 */
@Entity
@Table(name = "UserStats")
@NamedQueries(
{
    @NamedQuery(name = "UserStats.findAll", query = "SELECT u FROM UserStats u"),
    @NamedQuery(name = "UserStats.findByIdUserStats", query = "SELECT u FROM UserStats u WHERE u.idUserStats = :idUserStats"),
    @NamedQuery(name = "UserStats.findBySubmissions", query = "SELECT u FROM UserStats u WHERE u.submissions = :submissions"),
    @NamedQuery(name = "UserStats.findByAccepted", query = "SELECT u FROM UserStats u WHERE u.accepted = :accepted"),
    @NamedQuery(name = "UserStats.findByWrongAnswer", query = "SELECT u FROM UserStats u WHERE u.wrongAnswer = :wrongAnswer"),
    @NamedQuery(name = "UserStats.findByCompilationError", query = "SELECT u FROM UserStats u WHERE u.compilationError = :compilationError"),
    @NamedQuery(name = "UserStats.findByPresentationError", query = "SELECT u FROM UserStats u WHERE u.presentationError = :presentationError"),
    @NamedQuery(name = "UserStats.findByTimeLimitExceeded", query = "SELECT u FROM UserStats u WHERE u.timeLimitExceeded = :timeLimitExceeded"),
    @NamedQuery(name = "UserStats.findByRunTimeError", query = "SELECT u FROM UserStats u WHERE u.runTimeError = :runTimeError"),
    @NamedQuery(name = "UserStats.findByOutputLimitExceeded", query = "SELECT u FROM UserStats u WHERE u.outputLimitExceeded = :outputLimitExceeded"),
    @NamedQuery(name = "UserStats.findByRestrictedFunction", query = "SELECT u FROM UserStats u WHERE u.restrictedFunction = :restrictedFunction"),
    @NamedQuery(name = "UserStats.findByArithmeticError", query = "SELECT u FROM UserStats u WHERE u.arithmeticError = :arithmeticError"),
    @NamedQuery(name = "UserStats.findByMemoryLimitExceeded", query = "SELECT u FROM UserStats u WHERE u.memoryLimitExceeded = :memoryLimitExceeded"),
    @NamedQuery(name = "UserStats.findBySegmentationFault", query = "SELECT u FROM UserStats u WHERE u.segmentationFault = :segmentationFault"),
    @NamedQuery(name = "UserStats.findByUnknownError", query = "SELECT u FROM UserStats u WHERE u.unknownError = :unknownError")
})
public class UserStats implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idUserStats")
    private Integer idUserStats;
    @Column(name = "submissions")
    private Integer submissions;
    @Column(name = "Accepted")
    private Integer accepted;
    @Column(name = "WrongAnswer")
    private Integer wrongAnswer;
    @Column(name = "CompilationError")
    private Integer compilationError;
    @Column(name = "PresentationError")
    private Integer presentationError;
    @Column(name = "TimeLimitExceeded")
    private Integer timeLimitExceeded;
    @Column(name = "RunTimeError")
    private Integer runTimeError;
    @Column(name = "OutputLimitExceeded")
    private Integer outputLimitExceeded;
    @Column(name = "RestrictedFunction")
    private Integer restrictedFunction;
    @Column(name = "ArithmeticError")
    private Integer arithmeticError;
    @Column(name = "MemoryLimitExceeded")
    private Integer memoryLimitExceeded;
    @Column(name = "SegmentationFault")
    private Integer segmentationFault;
    @Column(name = "UnknownError")
    private Integer unknownError;
    @JoinColumn(name = "idUser", referencedColumnName = "idUser")
    @ManyToOne(optional = false)
    private User user;

    public UserStats()
    {
    }

    public UserStats(Integer idUserStats)
    {
        this.idUserStats = idUserStats;
    }

    public Integer getIdUserStats()
    {
        return idUserStats;
    }

    public void setIdUserStats(Integer idUserStats)
    {
        this.idUserStats = idUserStats;
    }

    public Integer getSubmissions()
    {
        return submissions;
    }

    public void setSubmissions(Integer submissions)
    {
        this.submissions = submissions;
    }

    public Integer getAccepted()
    {
        return accepted;
    }

    public void setAccepted(Integer accepted)
    {
        this.accepted = accepted;
    }

    public Integer getWrongAnswer()
    {
        return wrongAnswer;
    }

    public void setWrongAnswer(Integer wrongAnswer)
    {
        this.wrongAnswer = wrongAnswer;
    }

    public Integer getCompilationError()
    {
        return compilationError;
    }

    public void setCompilationError(Integer compilationError)
    {
        this.compilationError = compilationError;
    }

    public Integer getPresentationError()
    {
        return presentationError;
    }

    public void setPresentationError(Integer presentationError)
    {
        this.presentationError = presentationError;
    }

    public Integer getTimeLimitExceeded()
    {
        return timeLimitExceeded;
    }

    public void setTimeLimitExceeded(Integer timeLimitExceeded)
    {
        this.timeLimitExceeded = timeLimitExceeded;
    }

    public Integer getRunTimeError()
    {
        return runTimeError;
    }

    public void setRunTimeError(Integer runTimeError)
    {
        this.runTimeError = runTimeError;
    }

    public Integer getOutputLimitExceeded()
    {
        return outputLimitExceeded;
    }

    public void setOutputLimitExceeded(Integer outputLimitExceeded)
    {
        this.outputLimitExceeded = outputLimitExceeded;
    }

    public Integer getRestrictedFunction()
    {
        return restrictedFunction;
    }

    public void setRestrictedFunction(Integer restrictedFunction)
    {
        this.restrictedFunction = restrictedFunction;
    }

    public Integer getArithmeticError()
    {
        return arithmeticError;
    }

    public void setArithmeticError(Integer arithmeticError)
    {
        this.arithmeticError = arithmeticError;
    }

    public Integer getMemoryLimitExceeded()
    {
        return memoryLimitExceeded;
    }

    public void setMemoryLimitExceeded(Integer memoryLimitExceeded)
    {
        this.memoryLimitExceeded = memoryLimitExceeded;
    }

    public Integer getSegmentationFault()
    {
        return segmentationFault;
    }

    public void setSegmentationFault(Integer segmentationFault)
    {
        this.segmentationFault = segmentationFault;
    }

    public Integer getUnknownError()
    {
        return unknownError;
    }

    public void setUnknownError(Integer unknownError)
    {
        this.unknownError = unknownError;
    }

    public User getUser()
    {
        return user;
    }

    public void setUser(User user)
    {
        this.user = user;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idUserStats != null ? idUserStats.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UserStats))
        {
            return false;
        }
        UserStats other = (UserStats) object;
        if ((this.idUserStats == null && other.idUserStats != null) || (this.idUserStats != null && !this.idUserStats.equals(other.idUserStats)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "entities.UserStats[idUserStats=" + idUserStats + "]";
    }
    public VOUserStats getVO()
    {
        VOUserStats vo = new VOUserStats();
        vo.setAccepted(accepted);
        vo.setArithmeticError(arithmeticError);
        vo.setCompilationError(compilationError);
        vo.setIdUserStats(idUserStats);
        vo.setMemoryLimitExceeded(memoryLimitExceeded);
        vo.setOutputLimitExceeded(outputLimitExceeded);
        vo.setPresentationError(presentationError);
        vo.setUserHandle(user.getHandle());
        vo.setRestrictedFunction(restrictedFunction);
        vo.setRunTimeError(runTimeError);
        vo.setSegmentationFault(segmentationFault);
        vo.setSubmissions(submissions);
        vo.setTimeLimitExceeded(timeLimitExceeded);
        vo.setUnknownError(unknownError);
        vo.setWrongAnswer(wrongAnswer);
        return vo;
    }
}
